package com.anruisi.hxmes.auth.entity;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;

/**
*@author cmy
*@date 2021-01-29 17:02:22
*/
@Data
public class SysUser implements UserDetails {
    private Integer id;
    private String username;
    private String password;
    private int status;
    private String mobile;

    private Collection<? extends GrantedAuthority> authorities;
    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return authorities;
    }

    /**
     * security 账户过期 本项目无此功能
     * @return
     */
    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    /**
     * security 账户锁定 本项目无此功能
     * @return
     */
    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    /**
     * security 凭证过期 本项目无此功能
     * @return
     */
    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return status == 1;
    }
}